package org.example.test;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.example.JavaBean.Emp;
import org.example.Service.EmpService;
import org.example.util.JsonResult;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @Auther:Liu
 * @Testname:App
 * @Date:2025/7/29 15:28
 */
@Slf4j
@SpringBootTest
@EnableTransactionManagement
public class App {
    @Resource
    EmpService empService;

    @Test
    public void a() {
        JsonResult all = empService.findAll();
        log.info("all:{}", all);
    }

    @Test
    public void b() {
        JsonResult all = empService.findByEname("张");
        log.info("all:{}", all);
    }

    @Test
    public void c() {
        JsonResult all = empService.find();
        log.info("all:{}", all);
    }
    @Test
    public void d() {
        JsonResult all = empService.findByPage(1,10);
        log.info("all:{}", all);
    }

    @Test
    public void e() {
        Emp emp = new Emp();
        emp.setEname("张三111212121");
        emp.setJob("工程师");
        emp.setMgr(2000);
        emp.setSal(23.45);
        emp.setComm(null);
        emp.setDeptno(20);
        JsonResult all = empService.InsertOne(emp);
        log.info("all:{}", all);
    }
    @Test
    public void f() {
        JsonResult delete = empService.delete(666);
        log.info("delete:{}", delete);
    }

    @Test
    public void g(){
        Emp emp = new Emp();
        emp.setEname("小黑土");
        emp.setJob("工程师");
        emp.setMgr(2000);
        emp.setSal(23.45);
        emp.setComm(null);
        emp.setDeptno(20);
        JsonResult all = empService.InsertORDelete(8078,emp);
        log.info("all:{}", all);
    }
}
